exec --no-startup-id systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
exec --no-startup-id dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK
#output eDP-1 resolution 1920x1080

#launch notification daemon
exec mako

#set waybar as bar
bar swaybar_command waybar

# Variables
set $mod Mod4
set $term alacritty
set $menu rofi -m $(expr $(swaymsg -t get_tree | jq '.nodes | map([recurse(.nodes[]?, .floating_nodes[]?) | .focused] | any) | index(true)') - 1) -show drun -run-command 'swaymsg exec -- {cmd}'
set $menu rofi -m $(swaymsg -t get_outputs | jq 'map(select(.active) | .focused) | index(true)') -show drun -run-command 'swaymsg exec -- {cmd}'
set $background ~/Pictures/wallpapers/flutterstretch.jpg

for_window [class="XAVA"] border pixel 0

set $cl_high #e95986
set $cl_indi #e95986
set $cl_back #1d2c47
set $cl_fore #d9d8d8
set $cl_urge #ee249d

set $left h
set $down j
set $up k
set $right l

# Colors                border   bg       text     indi     childborder
client.focused          $cl_high $cl_high $cl_fore $cl_indi $cl_high
client.focused_inactive $cl_back $cl_back $cl_fore $cl_back $cl_back
client.unfocused        $cl_back $cl_back $cl_fore $cl_back $cl_back
client.urgent           $cl_urge $cl_urge $cl_fore $cl_urge $cl_urge

# Font
font unifont 12

# Window borders
default_border pixel 2
default_floating_border normal
hide_edge_borders smart

smart_gaps on
gaps inner 10

# keyboard layout
input * {
    xkb_layout latam
}

# Output configuration
output * bg $background fill

# Shortcuts
bindsym $mod+Return exec $term
bindsym $mod+d exec $menu

bindsym $mod+Shift+q kill
bindsym $mod+Shift+c reload

# Multimedia
bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5%
bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%
bindsym --locked XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym --locked XF86AudioPlay exec playerctl play-pause
bindsym --locked XF86AudioNext exec playerctl next
bindsym --locked XF86AudioPrev exec playerctl previous
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle

# Brightness controls
bindsym XF86MonBrightnessUp exec brightnessctl -c backlight set +5%
bindsym XF86MonBrightnessDown exec brightnessctl -c backlight set 5%-

# Take screenshots
set $LOCATION ~/Pictures/Screenshots/
set $filename $(date '+screenshot-%d-%m-%Y-%H:%M:%S.png')

# capture screen and save to $LOCATION
bindsym Print exec grim $LOCATION$filename

# capture specified area and save to $LOCATION
bindsym Shift+Print exec grim -g "$(slurp)" $LOCATION$filename

# capture active window and save to $LOCATION

bindsym Alt+Print exec swaymsg -t get_tree | jq -r '.. | (.nodes? // empty)[] | select(.focused) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | grim -g - - >> $LOCATION$filename

# capture all screens to clipboard    
bindsym Control+Print exec grim - | wl-copy    
    
# capture the specified screen area to clipboard    
bindsym Control+Shift+Print exec grim -g "$(slurp)" - | wl-copy  

# capture active window to clipboard
bindsym $mod+Print exec swaymsg -t get_tree | jq -r '.. | (.nodes? // empty)[] | select(.focused) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | grim -g - - | wl-copy


#Set layout for new windows
bindsym $mod+b splith
bindsym $mod+v splitv

# Move your focus around
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right

bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

# _move_ the focused window with the same, but add Shift
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right

bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right

    # Switch to workspace
    bindsym $mod+1 workspace number 1
    bindsym $mod+2 workspace number 2
    bindsym $mod+3 workspace number 3
    bindsym $mod+4 workspace number 4
    bindsym $mod+5 workspace number 5
    bindsym $mod+6 workspace number 6
    bindsym $mod+7 workspace number 7
    bindsym $mod+8 workspace number 8
    bindsym $mod+9 workspace number 9
    bindsym $mod+0 workspace number 10
    # Move focused container to workspace
    bindsym $mod+Shift+1 move container to workspace number 1
    bindsym $mod+Shift+2 move container to workspace number 2
    bindsym $mod+Shift+3 move container to workspace number 3
    bindsym $mod+Shift+4 move container to workspace number 4
    bindsym $mod+Shift+5 move container to workspace number 5
    bindsym $mod+Shift+6 move container to workspace number 6
    bindsym $mod+Shift+7 move container to workspace number 7
    bindsym $mod+Shift+8 move container to workspace number 8
    bindsym $mod+Shift+9 move container to workspace number 9
    bindsym $mod+Shift+0 move container to workspace number 10
    # Note: workspaces can have any name you want, not just numbers.
    # We just use 1-10 as the default.


# Layout stuff:

# Switch the current container between different layout styles
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

# Make the current focus fullscreen
bindsym $mod+f fullscreen

# Toggle the current focus between tiling and floating mode
bindsym $mod+Shift+space floating toggle
# Swap focus between the tiling area and the floating area
bindsym $mod+space focus mode_toggle

# move focus to the parent container
bindsym $mod+a focus parent

# Modes
mode "resize" {
    # left will shrink the containers width
    # right will grow the containers width
    # up will shrink the containers height
    # down will grow the containers height
    bindsym $left resize shrink width 10px
    bindsym $down resize grow height 10px
    bindsym $up resize shrink height 10px
    bindsym $right resize grow width 10px

    bindsym Left resize shrink width 10px
    bindsym Down resize grow height 10px
    bindsym Up resize shrink height 10px
    bindsym Right resize grow width 10px

    # return to default mode
    bindsym Return mode "default"
    bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"

#screensaver <3<3
for_window [title="Screensaver"] floating enable
for_window [title="Screensaver"] fullscreen enable

#cmatrix as screensaver
#exec swayidle timeout 600 '$term -t "Screensaver" -e cmatrix'

#video loop as screensaver
exec swayidle timeout 600 'mpv --title=Screensaver --really-quiet --alpha=yes -loop ~/Documents/importantmedia/pony/gifs/lyravibe.gif'

#display cornerpony
for_window [title="cornerpony"] floating enable, resize set 15 ppt 15 ppt, move position 85 ppt 85 ppt
exec mpv --title=cornerpony --alpha=yes --background=0/0/0/0  --geometry=15%x15% --no-border --no-osc -loop ~/Documents/importantmedia/pony/gifs/lyravibe.gif

#connect to home wifi
#exec nmcli dev wifi connect [YOUR SSID] password [YOUR PASSWORD]

#make clipboard's content shared amongst windows
exec wl-paste -t text --watch clipman store --no-persist

#disable changing focus by hovering windows with cursor
focus_follows_mouse no
